[HVM][SVM] Obtaining instruction address needs to mask to 32 bits
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 29 Sep 2006 10:50:51 +0000 (11:50 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 29 Sep 2006 10:50:51 +0000 (11:50 +0100)
if not running in 64-bit mode.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/hvm/svm/emulate.c

index 194a8be7fcd0b4ac242656544ccd2de50892dfb1..5adaa8d50dfac3096c7eb5735af5380b202defc8 100644 (file)
@@ -341,7 +341,11 @@ unsigned long svm_rip2pointer(struct vmcb_struct *vmcb)
      * %cs is update, but fortunately, base contain the valid base address
      * no matter what kind of addressing is used.
      */
-    return vmcb->cs.base + vmcb->rip;
+    unsigned long p = vmcb->cs.base + vmcb->rip;
+    if (!(vmcb->cs.attributes.fields.l && vmcb->efer & EFER_LMA))
+        return (u32)p; /* mask to 32 bits */
+    /* NB. Should mask to 16 bits if in real mode or 16-bit protected mode. */
+    return p;
 }